var MyModel=Backbone.Model.extend({
	idAttribute: "_id"
})


var MyServerCollection=Backbone.PageableCollection.extend({
	mode:"server",
	state:{
		pageSize:20
	},
	queryParams:{
		currentPage:"page",
		pageSize:"perpage",
		totalRecords:"totalRecords",
		totalPages:"totalPages"
	},
	parseState:function(resp,queryParams,state,options){
		var objState={}
		objState["totalRecords"]=resp[queryParams["totalRecords"]]
		return objState
	},
	parseRecords:function(resp,queryParams,state,options){
		return resp["data"]
	}
})


var MyPaginator=Backgrid.Extension.Paginator.extend({
	renderMultiplePagesOnly:true,
	windowSize:10,
	slideScale:0.8,
	goBackFirstOnSort:false
})

function table(descriptor,collection,grid){
	$(descriptor).append(grid.render().el)
	var myPaginator=new MyPaginator({
		collection:collection
	})
	$(descriptor).append(myPaginator.render().el)
}





